/**
 *
 * Copyright 2016-present scrm
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
import React from 'react';
import { connect } from 'react-redux';
import { Text, StyleSheet } from 'react-native';
import { bindActionCreators } from 'redux';
import { createIconSetFromIcoMoon } from 'react-native-vector-icons';
import icoMoonConfig from '../config/icoMoonConfig.json';
const Icon = createIconSetFromIcoMoon(icoMoonConfig);
import * as userCreators from '../actions/user';
import * as teamCreators from '../actions/team';
import Badge from '../components/Badge';


import Mine from '../pages/Mine/Mine';

class MineContainer extends React.Component {
  static navigationOptions = {
    title: '我的',
    tabBarIcon: ({ tintColor }) => (
      <Badge show={false}>
        <Icon name="mine_n" size={24} color={tintColor} />
      </Badge>
    ),
    headerRight: null
  };

  componentDidMount () {
  };

  render() {
    return <Mine {...this.props} />;
  }
}

const mapStateToProps = (state) => {
  const { user, team } = state;
  return {
    user,
    team
  };
};

const mapDispatchToProps = (dispatch) => {
  const userActions = bindActionCreators(userCreators, dispatch);
  const teamActions = bindActionCreators(teamCreators, dispatch);
  return {
    userActions,
    teamActions
  };
};

const styles = StyleSheet.create({
  saveTriggerStyle: {
    color: 'white', 
    padding: 10, 
    fontSize: 16, 
    fontWeight: 'bold'
  }
})

export default connect(mapStateToProps, mapDispatchToProps)(MineContainer);
